package com.easy.controller;

import com.easy.bean.Collect;
import com.easy.bean.Orderinfo;
import com.easy.service.ICollectService;
import com.easy.service.IOrderinfoService;
import com.easy.util.LayData;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("orderinfo")
public class OrderinfoController {
    @Autowired
    IOrderinfoService orderinfoService;


    @RequestMapping("list")
    @ResponseBody
    public LayData getList(Page page, String text,int orderid){
        List<Orderinfo> list=orderinfoService.getList(page,text,orderid);
        int count=orderinfoService.getCount(text);
        return new LayData(0,"获取成功",count,list);
    }
    @RequestMapping("delete")
    @ResponseBody
    public int delete(int id){
        return orderinfoService.delete(id);
    }

    @RequestMapping("add")
    @ResponseBody
    public int add(Orderinfo orderinfo){
        return orderinfoService.add(orderinfo);
    }

    @RequestMapping("edit")
    @ResponseBody
    public int edit(Orderinfo orderinfo){
        return orderinfoService.edit(orderinfo);
    }
}
